﻿@{
    Layout = null;
}
@model ElingOA6_Admin_DSJCJ.Model.LinkTypeEntry
<!DOCTYPE html>

<html>
<head>
   @if (false)
   {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
   }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/regex.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>

    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)
    <script>


//        function PreviewImg(s, e) {    
//            if (isValidateFile(s)) {
//                var newPreview = document.getElementById("newPreview");
//                newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = s.GetText();
//                newPreview.style.width = "100px";
//                newPreview.style.height = "80px";
//            }
//        }


//        function isValidateFile(obj) {
//            var extend = obj.GetText().substring(obj.GetText().lastIndexOf(".") + 1).toLowerCase();
//            if (extend == "") {
//            } else {
//                if (!(extend == "bmp" || extend == "jpg" || extend == "gif" || extend == "jpeg")) {
//                    alert("请上传图片文件!");
//                    var nf = obj.cloneNode(true);
//                    nf.value = '';
//                    obj.parentNode.replaceChild(nf, obj);
//                    return false;
//                }
//            }
//            return true;
//        }

        $(document).ready(function () {
            var hdjsAlert = $("#hidMessage").val();
            if (hdjsAlert != "") {
                alert(hdjsAlert);
                window.location.href = rootPath + "/Admin/LinkTypeManager/LinkTypeManagerList?linkTypeCD=" + $("#hidLinkTypeCD").val() + "&cd=" + $("#hidlinkTypeNo").val();
            }
        });
        /*返回*/

        function cancel() {
            javascript: history.go(-1);
        }


        //确定
        function ok() {

            var reg2 = /[^\w\u4e00-\u9fa5]/g;
            var linkText = FLinkText.GetText();
            if (linkText == "" || reg2.test(linkText)) {
                alert("类别名称只能是字母，数字及中文！");
                return false;
            }
            var linkURL = FLinkURL.GetText();
            if (linkURL == "") {
                alert("连接地址不能为空！");
                return false;
            }

            var reg = /[^\d]/g;
            var seq = FDispSeq.GetText();
            if (seq == "" || reg.test(seq)) {
                alert("显示顺序只能是数字！");
                return false;
            }
            form1.submit();
                   
        }


        function OnBeginCallback(s, e) {
            e.customArgs["command"] = e.command;
            e.customArgs["pageIndex"] = s.pageIndex;
            e.customArgs["pageCount"] = s.pageCount;
            e.customArgs["pageRowSize"] = s.pageRowSize;
            e.customArgs["pageRowCount"] = s.pageRowCount;
        }
    
    </script>


</head>
<body>
   @using (Html.BeginForm("Save", "LinkTypeManager", FormMethod.Post, new { id = "form1" }))
   {
        <table width="98%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td height="20">&nbsp;</td>
    </tr>
    <tr>
        <td>
            <table width="98%" align="center" border="0" cellspacing="0" cellpadding="0">
                <tr >
                  <th width="15%" height="25" align="center" valign="middle">
                   友情连接类别编号:
                  </th>
                  <td width="85%" valign="middle">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FLinkTypeCD";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(96);
                   settings.Text = Model.FLinkTypeCD;
                   settings.Enabled = false;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()       
                        @Html.Hidden("hidLinkTypeCD", Model.FLinkTypeCD)         
                  </td>
                </tr>
                <tr >
                  <th width="15%" height="25" align="center" valign="middle">
                    友情连接文本名称:
                  </th>
                  <td width="85%" valign="middle" >
		              @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FLinkText";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(96);
                   settings.Text = Model.FLinkText;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()
               @Html.Hidden("hidLinkText", Model.FLinkText)        
		          </td>
                </tr>
                <tr >
                  <th height="25" align="center" valign="middle" >
                    连接地址:
                  </th>
                  <td valign="middle" >
		             @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FLinkURL";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(96);
                   settings.Text = Model.FLinkURL;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()    
                  </td>
                </tr>
                <tr >
                  <th height="25" align="center" valign="middle">
                    显示顺序:
                  </th>
                  <td valign="middle">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FDispSeq";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(96);
                   settings.Text = Model.FDispSeq.ToString();
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
               }).GetHtml()    
                  </td>
                </tr>
                <tr >
                  <th height="25" align="center" valign="middle">
                    图标文件路径:
                  </th>
                  <td valign="middle">
                      @Html.DevExpress().UploadControl(
                        settings =>
                        {
                            settings.Name = "picUpload";
                            settings.BrowseButton.Text = "浏览";
                            settings.ClearFileSelectionImage.ToolTip = "清除选择";
                            settings.ShowProgressPanel = true;
                            settings.Enabled= (bool)ViewData["img"] ;
                            settings.ValidationSettings.MaxFileSize = 20971520;
                            settings.ValidationSettings.AllowedFileExtensions = new string[] { ".jpg", ".jpeg", ".jpe", ".gif", ".png" };
                            settings.ShowUploadButton = false;
                            //settings.ClientSideEvents.TextChanged= "function (s, e){ PreviewImg(s, e)}";
                        }).GetHtml()
                  </td>
                </tr>

              </table>
            </td>
        </tr>
      </table>

        <table width="100%" class="tableForm">
            <tr>
            <td width="40%">&nbsp;</td>
                <td align="center">
                 @Html.DevExpress().Button(settings =>
            {
                settings.Name = "btnOK";
                settings.Text = "确定";
                settings.ControlStyle.CssClass = "button";
                settings.Images.Image.Url = Url.Content("~/Content/ControlImages/ok.png");
                settings.ClientSideEvents.Click = "function(){ok()}";
            }).GetHtml()

                @Html.DevExpress().Button(settings =>
           {
               settings.Name = "btnCancel";
               settings.Text = "取消";
               settings.ControlStyle.CssClass = "button";
               settings.Images.Image.Url = Url.Content("~/Content/ControlImages/no.png");
               settings.CausesValidation = false;
               settings.ClientSideEvents.Click = "cancel";
           }).GetHtml()

                </td>
            </tr>
        </table>
    
      <table width="98%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center" height="30">
                &nbsp;
            </td>
          </tr>
          <tr>
            <td align="center">
                <div id="newPreview"></div> 
            </td>
          </tr>
      </table>
       @Html.Hidden("hidSaveType", "save");
       @Html.Hidden("hidMessage", ViewData["message"]);
       @Html.Hidden("hidIsClose", ViewData["IsClose"])
       @Html.Hidden("hidlinkTypeNo", ViewData["linkTypeNo"])

   }  

</body>
</html>
